﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Member.Web
{
    public partial class AddComment : BasePage.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {


            if (DropDownList1.SelectedValue.Equals("0"))
            {
                string[] resultString = Regex.Split(TextBox1.Text, "\r\n", RegexOptions.IgnoreCase);
                int num = 1;
                foreach (string i in resultString)
                {
                    string[] userpasswd = i.Split('|');
                    __model_comments.Name = userpasswd[0];
                    __model_comments.Passwd = userpasswd[1];
                    __bll_comments.AddCommentUser(__model_comments);
                }
                Response.Write("<script>alert('成功添加【" + num + "】个用户')");
            }
            else if (DropDownList1.SelectedValue.Equals("1"))
            {
                string[] resultString = Regex.Split(TextBox1.Text, "\r\n", RegexOptions.IgnoreCase);
                int num = 1;
                foreach (string i in resultString)
                {
                    __model_comments.Comments = i.ToString();
                    __bll_comments.AddComments(__model_comments);
                    num++;
                }
                Response.Write("<script>alert('成功添加【"+num+"】条评论语')");
            }
        }
    }
}